<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/common.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../css/templet.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../fonts/font-awesome.min.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../mui/css/mui.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../ali/iconfont.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../css/queue.css"/>
		<script type="text/javascript" src="../common/js/jquery.js?01_38"></script>
		
		<!--插件-->
		<script type="text/javascript" src="../common/js/vue.min.js?01_38"></script>
		<script type="text/javascript" src="../common/js/mui.min.js?01_38"></script>
		<script type="text/javascript" src="../common/js/update.js?01_38"></script>
		
		<script type="text/javascript" src="../common/js/common.js?01_38"></script>
		<script type="text/javascript" src="../common/js/fastclick.js?01_38"></script>
		<script type="text/javascript" src="../common/js/main.js?01_38"></script>
		<script type="text/javascript" src="../common/js/app.js?01_38"></script>
		<style type="text/css">
			.childFooter .footerList .bg.bg_01 { background-image: url(../images/queue/fb_01.png);} 
			.mui-popup-text { color: #fd5749;}
		</style>
	</head>
	<body>
		<!--头部-->
		<header class="bg-red9 fff f-20 pad-t-10 pad-b-10 pad-r-10">
			<div class="pa back pad-l-10 back re" onclick="backpre()">
				<div class="order_back"></div>
				<a></a>
			</div>
			<div @click="test()" class="center header_title"></div>
			<!--<div class="pa set">
				<a href="queue_set.html" class="fff f-15 pad-r-10"><i></i></a>
			</div>-->
		</header>
		<div id="app" v-cloak="">
			<div class="wrap_body queue_set bg-e4">
				
				<div class="pad-t-45 pad-b-80">
					<div class="f-15">
						<div class="list">
							<div class="bank5"></div>
							<div class="fiex bg-fff pad-12 pad-t-20 pad-b-20" @click="gotoart('queue_printSetup.html')">
								<div class="fiex1">{{b_lg['1472']}}</div>
								<div class="right bg"></div>
							</div>
						</div>
						<div class="list">
							<div class="bank5"></div>
							<div class="fiex bg-fff pad-12 pad-t-20 pad-b-20" @click="passNumber()">
								<div class="fiex1">{{b_lg['1475']}}</div>
								<div class="right bg"></div>
							</div>
						</div>
						<div class="list">
							<div class="bank5"></div>
							<div class="fiex bg-fff pad-12 pad-t-20 pad-b-20" @click="queue()">
								<div class="fiex1"><span v-if="is_open == 1">{{b_lg['1476']}}</span><span v-else-if="is_open == 0">{{b_lg['1477']}}</span></div>
								<div class="right bg"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		//头部返回键
		function backpre () {
			if(isAPP) {
				var preUrl = plus.webview.currentWebview().opener();
				preUrl.evalJS("refresh()");
			}
			com_back();
		}
		//下拉刷新
		function refresh () {
			common_ajax(1, {"q_id":0}, "get_queue_list", function(res) {
				if (res.status == 1) {
					count = 0;
					$.each(res.result.count_list, function(i,v) {
						count += v;
					});
					app.count = count;
				}
			})
			app.get_stop_queue();
			app.is_open = webSocket_stopQueue.data.is_open;
		}
		var app = null;
		function fun1 () {
			down_load(); //下拉刷新开启
			app = new Vue({
				el:"#app",
				data:{
					b_lg: global_lange, //语言包
					count:"",
					cur_all_queue_count:"",
					is_open:""//排队功能是否开启 1开启 0停止
				},
				created: function () {
					this.init();
				},
				methods:{
					init: function () {
						common_ajax(1, {}, "init_shop_info", function(res) {
							$("header .header_title").text(app.b_lg['1474']);
							app.is_open = res.result.queue_set.is_open;
							common_ajax(1, {"q_id":0}, "get_queue_list", function(res) {
								if (res.status == 1) {
									var count = 0;
									$.each(res.result.count_list, function(i,v) {
										count += v;
									});
									app.count = count;
								}
							})
						})
					},
					get_stop_queue: function () {
						webSocket_stopQueue = JSON.parse(getItem("webSocket_stopQueue"));
					},
					gotoart: function (e) {
						clicked(e);
					},
					toQueue: function (n) {
						clicked('queue_takeNumber.html');
						setItem("pageflag",n);
					},
					passNumber: function () {
						if (app.count == 0) {
							var btnArray1 = [app.b_lg['1008']];
							mui.confirm(app.b_lg['1490'], app.b_lg['1320'], btnArray1, function(ee) {
								if(ee.index == 0) {
									app.init();
								}
							},"div")
						}else {
							var btnArray2 = [app.b_lg['1049'], app.b_lg['1008']];
							mui.confirm(app.b_lg['1491']+" "+app.count,app.b_lg['1492'], btnArray2, function(ee) {
								if(ee.index == 1) {
									//确定
									common_ajax(1,{}, "queue_expire_all", function(res) {
										if (res.status == 1) {
											//排队列表
										}
									})
								}
							},"div")
						}
					},
					queue: function () {
						if (app.is_open == 0) {
							var btnArray2 = [app.b_lg['1049'], app.b_lg['1008']];
							mui.confirm(app.b_lg['1493'], app.b_lg['1320'], btnArray2, function(ee) {
								if(ee.index == 1) {
									//确定
									common_ajax(1,{"is_open":1}, "queue_stop_start", function(res) {
										if (res.status == 1) {
											//排队列表
										}
									})
								}
							},"div")
						}else if (app.is_open == 1) {
							var btnArray2 = [app.b_lg['1049'], app.b_lg['1008']];
							mui.confirm(app.b_lg['1494'], app.b_lg['1320'], btnArray2, function(ee) {
								if(ee.index == 1) {
									//确定
									common_ajax(1,{"is_open":0}, "queue_stop_start", function(res) {
										if (res.status == 1) {
											//排队列表
										}
									})
								}
							},"div")
						}
						
					}
				}
			})
		}
	</script>
</html>
